package ru.evga.inse.server.gwt.admin.client.menu;

import ru.evga.inse.server.gwt.admin.client.IAdminAppFactory;
import ru.evga.inse.server.gwt.admin.client.place.AdminMenuPlaceUtil;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;


public class MenuActivity
    extends AbstractActivity
    implements MenuView.Presenter
{
    private IAdminAppFactory m_factory;
    
    
    public MenuActivity(IAdminAppFactory factory)
    {
        m_factory = factory;
    }
    
    public void start(AcceptsOneWidget panel, EventBus eventBus)
    {
        MenuView menuView = m_factory.getViewFactory().getMenuView();
        menuView.setPresenter(this);
        panel.setWidget(menuView.asWidget());
    }

    public void goToCity()
    {
        m_factory.getPlaceController().goTo(AdminMenuPlaceUtil.getBuilderForMenu(AdminMenuItem.CITY).build());
    }

    public void goToStreet()
    {
        m_factory.getPlaceController().goTo(AdminMenuPlaceUtil.getBuilderForMenu(AdminMenuItem.STREET).build());
    }

}
